home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
Foxpro 2.6 {Windows}
/
SETUP.IN_
/
SETUP.bin
Wrap
Text File
|
1994-03-10
|
49KB
|
1,446 lines
''***************************************************************************
'' ICONBTN.INC
''***************************************************************************
DECLARE FUNCTION IconBtnWndFn LIB "IconBtn.dll" (arg1%, arg2%, arg3%) AS INTEGER
''***************************************************************************
'' SETUPAPI.INC
''***************************************************************************
GLOBAL hSetup AS INTEGER
GLOBAL fFrameInit AS INTEGER
GLOBAL fInstallInit AS INTEGER
CONST SM_CXSCREEN = 0
CONST SM_CYSCREEN = 1
CONST WF_80x87 = 1024
CONST WF_CPU186 = 128
CONST WF_CPU286 = 2
CONST WF_CPU386 = 4
CONST WF_CPU486 = 8
CONST WF_STANDARD = 16
CONST WF_ENHANCED = 32
CONST MB_OK = 0
CONST MB_ICONHAND = 16
CONST MB_TASKMODAL = 8192
DECLARE FUNCTION DoMsgBox LIB "mscomstf.dll" (lpText$,lpCaption$,wType%) As INTEGER
DECLARE FUNCTION GetWindowsDirectory LIB "kernel" (szBuf$, cbBuf%) AS INTEGER
DECLARE FUNCTION GetSystemDirectory LIB "kernel" (szBuf$, cbBuf%) AS INTEGER
DECLARE FUNCTION GetProfileString LIB "kernel" (szSect$, szKey$, szDefault$, szBuf$, cbBuf%) AS INTEGER
DECLARE FUNCTION GetVersion LIB "kernel" AS INTEGER
DECLARE FUNCTION GetSystemMetrics LIB "user" (nIndex%) AS INTEGER
DECLARE FUNCTION GetWinFlags LIB "kernel" AS LONG
CONST cmoVital = 1
CONST cmoCopy = 2
CONST cmoUndo = 4
CONST cmoRoot = 8
CONST cmoDecompress = 16
CONST cmoTimeStamp = 32
CONST cmoReadOnly = 64
CONST cmoBackup = 128
CONST cmoForce = 256
CONST cmoRemove = 512
CONST cmoOverwrite = 1024
CONST cmoAppend = 2048
CONST cmoPrepend = 4096
CONST cmoNone = 0
CONST cmoAll = 65535
CONST femExists = 0
CONST femRead = 1
CONST femWrite = 2
CONST femReadWrite = 3
CONST ynrcNo = 0
CONST ynrcYes = 1
CONST ynrcErr1 = 2
CONST ynrcErr2 = 3
CONST ynrcErr3 = 4
CONST ynrcErr4 = 5
CONST ynrcErr5 = 6
CONST ynrcErr6 = 7
CONST ynrcErr7 = 8
CONST ynrcErr8 = 9
CONST ynrcErr9 = 10
CONST grcOkay = 0
CONST grcNotOkay = 1
CONST grcUserQuit = 48
CONST cbSymValMax = 512
CONST STFERR = 1024 ''setup system error
CONST STFQUIT = 1025 ''user quit
CONST STFPROGMAN = 32766 ''couldn't create Program Manager stuff
CONST scmOff = 0
CONST scmOnIgnore = 1
CONST scmOnFatal = 2
DECLARE FUNCTION FParseFATPathIntoPieces LIB "mscomstf.dll" (szPath$, szVol$, cbVol%, szDir$, cbDir%, szFile$, cbFile%) AS INTEGER
DECLARE FUNCTION FOpenInf LIB "mscomstf.dll" (szFile$, fCheck%, fCheckSyms%) AS INTEGER
DECLARE FUNCTION FSetSilent LIB "mscomstf.dll" (mode%) AS INTEGER
DECLARE FUNCTION FSetBeepingMode LIB "mscomstf.dll" (mode%) AS INTEGER
DECLARE FUNCTION HShowWaitCursor LIB "msshlstf.dll" AS INTEGER
DECLARE FUNCTION FRestoreCursor LIB "msshlstf.dll" (hPrev%) AS INTEGER
DECLARE FUNCTION FOpenLogFile LIB "mscomstf.dll" (szFile$, fAppend%) AS INTEGER
DECLARE FUNCTION FCloseLogFile LIB "mscomstf.dll" AS INTEGER
DECLARE FUNCTION FWriteToLogFile LIB "mscomstf.dll" (sz$, fRequire%) AS INTEGER
DECLARE FUNCTION CbGetInfSectionKeyField LIB "mscomstf.dll" (szSect$, szKey$, iField%, szBuf$, cbBuf%) AS INTEGER
DECLARE FUNCTION FMakeListInfSectionField LIB "mscomstf.dll" (szSym$, szSect$, iField%) AS INTEGER
DECLARE FUNCTION PbSaveMemInf LIB "mscomstf.dll" AS LONG
DECLARE SUB RestoreMemInf LIB "mscomstf.dll" (pb&)
DECLARE SUB FreeMemInf LIB "mscomstf.dll" (pb&)
DECLARE FUNCTION FSetBitmap LIB "msshlstf.dll" (szDll$, Bitmap%) AS INTEGER
DECLARE FUNCTION FSetAbout LIB "msshlstf.dll" (szAbout1$, szAbout2$) AS INTEGER
DECLARE FUNCTION FDoDialogExt LIB "msuilstf.dll" (hwnd%, szDll$, Dlg%, szDlgProc$, szHelpDll$, HelpDlg%, szHelpProc$) AS INTEGER
DECLARE FUNCTION FKillNDialogs LIB "msuilstf.dll" (n%) AS INTEGER
DECLARE SUB SetWindowText LIB "User" (hwnd%, lpString$)
DECLARE FUNCTION FSetSymbolValue LIB "msshlstf.dll" (szSymbol$, szValue$) AS INTEGER
DECLARE FUNCTION FRemoveSymbol LIB "mscomstf.dll" (szSym$) AS INTEGER
DECLARE FUNCTION CbGetSymbolValue LIB "mscomstf.dll" (szSymbol$, szValue$, Length%) AS INTEGER
DECLARE FUNCTION UsGetListLength LIB "mscomstf.dll" (szSymbol$) AS INTEGER
DECLARE FUNCTION CbGetListItem LIB "mscomstf.dll" (szListSymbol$, n%, szListItem$, cbMax%) AS INTEGER
DECLARE FUNCTION FAddListItem LIB "mscomstf.dll" (szListSymbol$, szListItem$) AS INTEGER
DECLARE FUNCTION FReplaceListItem LIB "mscomstf.dll" (szListSymbol$, n%, szListItem$) AS INTEGER
DECLARE FUNCTION FSetSymbolToListOfInfKeys LIB "mscomstf.dll" (szSym$, szSect$, fNulls%) AS INTEGER
DECLARE FUNCTION InitializeFrame LIB "msshlstf.dll" (szCmdLine$) AS INTEGER
DECLARE FUNCTION HwndFrame LIB "msshlstf.dll" AS INTEGER
DECLARE FUNCTION HinstFrame LIB "msshlstf.dll" AS INTEGER
DECLARE SUB ProSetPos LIB "msinsstf.dll" (x%, y%)
DECLARE FUNCTION FCreateDir LIB "msinsstf.dll" (szDir$, cmo%) AS INTEGER
DECLARE FUNCTION FRemoveDir LIB "msinsstf.dll" (szDir$, cmo%) AS INTEGER
DECLARE FUNCTION FAddSectionFilesToCopyList LIB "mscomstf.dll" (szSect$, szSrc$, szDest$) AS INTEGER
DECLARE FUNCTION FAddSectionKeyFileToCopyList LIB "mscomstf.dll" (szSect$, szKey$, szSrc$, szDest$) AS INTEGER
DECLARE FUNCTION FAddSpecialFileToCopyList LIB "mscomstf.dll" (szSect$, szKey$, szSrc$, szDest$) AS INTEGER
DECLARE FUNCTION GrcCopyFilesInCopyList LIB "msinsstf.dll" (hInstance%) AS INTEGER
DECLARE FUNCTION FRemoveIniSection LIB "msinsstf.dll" (szFile$, szSect$, cmo%) AS INTEGER
DECLARE FUNCTION FCreateIniKeyValue LIB "msinsstf.dll" (szFile$, szSect$, szKey$, szValue$, cmo%) AS INTEGER
DECLARE FUNCTION FRemoveIniKey LIB "msinsstf.dll" (szFile$, szSect$, szKey$, cmo%) AS INTEGER
DECLARE FUNCTION FCreateSysIniKeyValue LIB "msinsstf.dll" (szFile$, szSect$, szKey$, szValue$, cmo%) AS INTEGER
DECLARE FUNCTION FCreateProgManGroup LIB "msinsstf.dll" (szGroup$, szPath$, cmo%) AS INTEGER
DECLARE FUNCTION FCreateProgManItem LIB "msinsstf.dll" (szGroup$, szItem$, szCmd$, cmo%) AS INTEGER
DECLARE FUNCTION FShowProgManGroup LIB "msinsstf.dll" (szGroup$, szCmd$, cmo%) AS INTEGER
DECLARE FUNCTION FStampResource LIB "msinsstf.dll" (szSect$, szKey$, szDst$, wResType%, wResId%, szData$, cbData%) AS INTEGER
DECLARE FUNCTION FDumpCopyListToFile LIB "msinsstf.dll" (szFile$) AS INTEGER
DECLARE SUB ResetCopyList LIB "msinsstf.dll"
DECLARE FUNCTION LcbGetCopyListCost LIB "msinsstf.dll" (szExtraList$, szCostList$, szNeedList$) AS LONG
DECLARE FUNCTION FAddDos5Help LIB "msinsstf.dll" (szProgName$, szProgHelp$, cmo%) AS INTEGER
DECLARE FUNCTION FCopyOneFile LIB "msinsstf.dll" (szSrc$, szDest$, cmo%, fAppend%) AS INTEGER
DECLARE FUNCTION YnrcRemoveFile LIB "msinsstf.dll" (szFullPathSrc$, cmo%) AS INTEGER
DECLARE FUNCTION YnrcBackupFile LIB "msinsstf.dll" (szFullPath$, szBackup$, cmo%) AS INTEGER
DECLARE FUNCTION FInitializeInstall LIB "msinsstf.dll" (hinst%, hwndFrame%) AS INTEGER
DECLARE FUNCTION WFindFileUsingFileOpen LIB "msinsstf.dll" (szFile$, szBuf$, cbBuf%) AS INTEGER
DECLARE FUNCTION FIsDirWritable LIB "msinsstf.dll" (szDir$) AS INTEGER
DECLARE FUNCTION FIsFileWritable LIB "msinsstf.dll" (szFile$) AS INTEGER
DECLARE FUNCTION FAddToBillboardList LIB "msinsstf.dll" (szDll$, idDlg%, szProc$, lTicks&) AS INTEGER
DECLARE FUNCTION FClearBillboardList LIB "msinsstf.dll" AS INTEGER
DECLARE FUNCTION FSetRestartDir LIB "msinsstf.dll" (szDir$) AS INTEGER
DECLARE FUNCTION FRestartListEmpty LIB "msinsstf.dll" AS INTEGER
DECLARE FUNCTION FExitExecRestart LIB "msinsstf.dll" AS INTEGER
DECLARE FUNCTION SetCopyMode LIB "msinsstf.dll" (fMode%) AS INTEGER
DECLARE FUNCTION GetCopyMode LIB "msinsstf.dll" AS INTEGER
DECLARE FUNCTION SetDecompMode LIB "msinsstf.dll" (fMode%) AS INTEGER
DECLARE FUNCTION GetDecompMode LIB "msinsstf.dll" AS INTEGER
DECLARE FUNCTION SetSizeCheckMode LIB "msinsstf.dll" (scmMode%) AS INTEGER
DECLARE FUNCTION FPrependToPath LIB "msinsstf.dll" (szSrc$, szDst$, szDir$, cmo%) AS INTEGER
DECLARE FUNCTION SetTimeValue LIB "msinsstf.dll" (usHours%, usMinutes%, usSeconds%) AS INTEGER
DECLARE SUB ForceRestartOn LIB "msinsstf.dll"
DECLARE SUB SetBitmap(szDll$, Bitmap%)
DECLARE SUB SetAbout(szAbout1$, szAbout2$)
DECLARE FUNCTION UIStartDlgExt(szDll$, Dlg%, szDlgProc$, szHelpDll$, HelpDlg%, szHelpProc$) AS STRING
DECLARE FUNCTION UIStartDlg(szDll$, Dlg%, szDlgProc$, HelpDlg%, szHelpProc$) AS STRING
DECLARE SUB UIPop (n%)
DECLARE SUB UIPopAll
DECLARE SUB SetTitle (sz$)
DECLARE SUB ReadInfFile (szFile$)
DECLARE SUB SetSymbolValue (szSymbol$, szValue$)
DECLARE SUB RemoveSymbol (szSym$)
DECLARE FUNCTION GetSymbolValue (szSymbol$) AS STRING
DECLARE FUNCTION GetListLength(szSymbol$) AS INTEGER
DECLARE SUB MakeListFromSectionKeys (szSymbol$, szSect$)
DECLARE FUNCTION GetListItem(szSymbol$, n%) AS STRING
DECLARE SUB AddListItem(szSymbol$, szItem$)
DECLARE SUB ReplaceListItem(szSymbol$, n%, szItem$)
DECLARE FUNCTION InitFrame (szCmdLine$) AS INTEGER
DECLARE FUNCTION InitSetup (szCmdLine$) AS INTEGER
DECLARE FUNCTION ShowWaitCursor AS INTEGER
DECLARE SUB RestoreCursor (hPrev%)
DECLARE FUNCTION SetBeepingMode (mode%) AS INTEGER
DECLARE FUNCTION SetSilentMode (mode%) AS INTEGER
DECLARE FUNCTION GetSectionKeyDate (szSect$, szKey$) AS STRING
DECLARE FUNCTION GetSectionKeyFilename (szSect$, szKey$) AS STRING
DECLARE FUNCTION GetSectionKeySize (szSect$, szKey$) AS LONG
DECLARE FUNCTION GetSectionKeyVersion (szSect$, szKey$) AS STRING
DECLARE SUB MakeListFromSectionDate (szSym$, szSect$)
DECLARE SUB MakeListFromSectionFilename (szSym$, szSect$)
DECLARE SUB MakeListFromSectionSize (szSym$, szSect$)
DECLARE SUB MakeListFromSectionVersion (szSym$, szSect$)
DECLARE SUB CreateDir (szDir$, cmo%)
DECLARE SUB RemoveDir (szDir$, cmo%)
DECLARE SUB AddSectionFilesToCopyList (szSect$, szSrc$, szDest$)
DECLARE SUB AddSectionKeyFileToCopyList (szSect$, szKey$, szSrc$, szDest$)
DECLARE SUB AddSpecialFileToCopyList (szSect$, szKey$, szSrc$, szDest$)
DECLARE SUB CopyFilesInCopyList
DECLARE SUB RemoveIniSection (szFile$, szSect$, cmo%)
DECLARE SUB CreateIniKeyValue (szFile$, szSect$, szKey$, szValue$, cmo%)
DECLARE SUB RemoveIniKey (szFile$, szSect$, szKey$, cmo%)
DECLARE SUB CreateSysIniKeyValue (szFile$, szSect$, szKey$, szValue$, cmo%)
DECLARE SUB CreateProgmanGroup (szGroup$, szPath$, cmo%)
DECLARE SUB CreateProgmanItem (szGroup$, szItem$, szCmd$, szOther$, cmo%)
DECLARE SUB ShowProgmanGroup (szGroup$, Cmd%, cmo%)
DECLARE SUB StampResource (szSect$, szKey$, szDst$, wResType%, wResId%, szData$, cbData%)
DECLARE SUB DumpCopyList (szFile$)
DECLARE SUB ClearCopyList
DECLARE FUNCTION GetCopyListCost (szExtraList$, szCostList$, szNeedList$) AS LONG
DECLARE SUB AddDos5Help (szProgName$, szProgHelp$, cmo%)
DECLARE SUB CopyFile (szFullPathSrc$, szFullPathDst$, cmo%, fAppend%)
DECLARE SUB RemoveFile (szFullPathSrc$, cmo%)
DECLARE SUB BackupFile (szFullPath$, szBackup$)
DECLARE SUB RenameFile (szFullPath$, szBackup$)
DECLARE SUB InitInstall
DECLARE SUB AddToBillboardList (szDll$, idDlg%, szProc$, lTicks&)
DECLARE SUB AddBlankToBillboardList (lTicks&)
DECLARE SUB ClearBillboardList
DECLARE SUB OpenLogFile (szFile$, fAppend%)
DECLARE SUB CloseLogFile
DECLARE SUB WriteToLogFile (szStr$)
DECLARE SUB SetCopyGaugePosition (x%, y%)
DECLARE SUB SetRestartDir(szDir$)
DECLARE FUNCTION RestartListEmpty AS INTEGER
DECLARE FUNCTION ExitExecRestart AS INTEGER
DECLARE FUNCTION FindFileUsingFileOpen (szFile$) AS STRING
DECLARE FUNCTION IsDirWritable (szDir$) AS INTEGER
DECLARE FUNCTION IsFileWritable (szFile$) AS INTEGER
DECLARE FUNCTION GetNthFieldFromIniString (szLine$, iField%) AS STRING
DECLARE SUB PrependToPath (szSrc$, szDst$, szDir$, cmo%)
DECLARE FUNCTION GetWindowsMajorVersion AS INTEGER
DECLARE FUNCTION GetWindowsMinorVersion AS INTEGER
DECLARE FUNCTION GetWindowsMode AS INTEGER
DECLARE FUNCTION GetWindowsDir AS STRING
DECLARE FUNCTION GetWindowsSysDir AS STRING
DECLARE FUNCTION IsWindowsShared AS INTEGER
DECLARE FUNCTION GetScreenWidth AS INTEGER
DECLARE FUNCTION GetScreenHeight AS INTEGER
FUNCTION InitSetup(szCmdLine$) STATIC AS INTEGER
fFrameInit = 0
fInstallInit = 0
IF hSetup > 0 THEN
END IF
i% = InitFrame(szCmdLine$)
fFrameInit = 1
InitInstall
fInstallInit = 1
InitSetup = i%
END FUNCTION
FUNCTION InitFrame(szCmdLine$) STATIC AS INTEGER
IF hSetup > 0 THEN
ELSE
i% = InitializeFrame(szCmdLine$)
IF i% = -1 THEN
END '' NOT an error - Usage (/?) or Command line copy operation
ELSEIF i% = 0 THEN
END
ELSE
InitFrame = i%
END IF
END IF
END FUNCTION
SUB SetBitmap(szDll$, Bitmap%) STATIC
IF FSetBitmap(szDll$, Bitmap%) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB SetAbout(szAbout1$, szAbout2$) STATIC
IF FSetAbout(szAbout1$, szAbout2$) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB SetTitle(sz$) STATIC
SetWindowText HwndFrame(), sz$
END SUB
SUB ReadInfFile (szFile$) STATIC
IF FOpenInf(szFile$, 1, 0) = 0 THEN
ERROR STFERR
END IF
END SUB
FUNCTION UIStartDlg(szDll$, Dlg%, szDlgProc$, HelpDlg%, szHelpProc$) STATIC AS STRING
IF FDoDialogExt(HwndFrame(), szDll$, Dlg%, szDlgProc$, szDll$, HelpDlg%, szHelpProc$) = 0 THEN
ERROR STFERR
ELSE
UIStartDlg = GetSymbolValue("DLGEVENT")
END IF
END FUNCTION
FUNCTION UIStartDlgExt(szDll$, Dlg%, szDlgProc$, szHelpDll$, HelpDlg%, szHelpProc$) STATIC AS STRING
IF FDoDialogExt(HwndFrame(), szDll$, Dlg%, szDlgProc$, szHelpDll$, HelpDlg%, szHelpProc$) = 0 THEN
ERROR STFERR
ELSE
UIStartDlgExt = GetSymbolValue("DLGEVENT")
END IF
END FUNCTION
SUB UIPop (n%) STATIC
IF FKillNDialogs(n%) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB UIPopAll STATIC
IF FKillNDialogs(65535) = 0 THEN
ERROR STFERR
END IF
END SUB
FUNCTION GetSymbolValue(szSymbol$) STATIC AS STRING
szValue$ = string$(cbSymValMax,32)
Length% = CbGetSymbolValue(szSymbol$, szValue$, cbSymValMax)
GetSymbolValue = szValue$
IF Length% >= cbSymValMax THEN
res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
ERROR STFERR
END IF
IF szSymbol$ = "" THEN
ERROR STFERR
END IF
szValue$ = ""
END FUNCTION
FUNCTION GetListLength(szSymbol$) STATIC AS INTEGER
GetListLength = UsGetListLength(szSymbol$)
IF szSymbol$ = "" THEN
ERROR STFERR
END IF
END FUNCTION
FUNCTION GetListItem(szListSymbol$, nItem%) STATIC AS STRING
szListItem$ = string$(cbSymValMax,32)
Length% = CbGetListItem(szListSymbol$, nItem%, szListItem$, cbSymValMax)
GetListItem = szListItem$
IF Length% >= cbSymValMax THEN
res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
ERROR STFERR
END IF
IF szListSymbol$ = "" THEN
ERROR STFERR
END IF
if nItem% <= 0 or nItem% > GetListLength(szListSymbol$) then
ERROR STFERR
end if
szListItem$ = ""
END FUNCTION
SUB AddListItem(szSymbol$, szItem$) STATIC
IF FAddListItem(szSymbol$, szItem$) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB ReplaceListItem(szSymbol$, n%, szItem$) STATIC
IF FReplaceListItem(szSymbol$, n%, szItem$) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB MakeListFromSectionKeys(szSymbol$, szSect$) STATIC
IF FSetSymbolToListOfInfKeys(szSymbol$, szSect$, 1) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB SetSymbolValue(szSymbol$, szValue$) STATIC
IF FSetSymbolValue(szSymbol$, szValue$) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB RemoveSymbol(szSym$) STATIC
IF FRemoveSymbol(szSym$) = 0 THEN
ERROR STFERR
END IF
END SUB
FUNCTION ShowWaitCursor STATIC AS INTEGER
ShowWaitCursor = HShowWaitCursor
END FUNCTION
SUB RestoreCursor (hPrev%) STATIC
i% = FRestoreCursor(hPrev%)
IF i% = 0 THEN
ERROR STFERR
END IF
END SUB
FUNCTION SetBeepingMode (mode%) STATIC AS INTEGER
SetBeepingMode = FSetBeepingMode(mode%)
END FUNCTION
FUNCTION SetSilentMode (mode%) STATIC AS INTEGER
SetSilentMode = FSetSilent(mode%)
END FUNCTION
FUNCTION GetSectionKeyDate (szSect$, szKey$) STATIC AS STRING
szBuf$ = string$(128, 32)
Length% = CbGetInfSectionKeyField(szSect$, szKey$, 5, szBuf$, 128)
IF Length% >= 128 THEN
res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
ERROR STFERR
END IF
IF Length% = -1 THEN
ERROR STFERR
END IF
GetSectionKeyDate = szBuf$
szBuf$ = ""
END FUNCTION
FUNCTION GetSectionKeyFilename (szSect$, szKey$) STATIC AS STRING
szBuf$ = string$(128, 32)
Length% = CbGetInfSectionKeyField(szSect$, szKey$, 1, szBuf$, 128)
IF Length% >= 128 THEN
res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
ERROR STFERR
END IF
IF Length% = -1 THEN
ERROR STFERR
END IF
GetSectionKeyFilename = szBuf$
szBuf$ = ""
END FUNCTION
FUNCTION GetSectionKeySize (szSect$, szKey$) STATIC AS LONG
szBuf$ = string$(128, 32)
Length% = CbGetInfSectionKeyField(szSect$, szKey$, 15, szBuf$, 128)
IF Length% >= 128 THEN
res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
ERROR STFERR
END IF
IF Length% = -1 THEN
ERROR STFERR
END IF
GetSectionKeySize = VAL(szBuf$)
szBuf$ = ""
END FUNCTION
FUNCTION GetSectionKeyVersion (szSect$, szKey$) STATIC AS STRING
szBuf$ = string$(128, 32)
Length% = CbGetInfSectionKeyField(szSect$, szKey$, 19, szBuf$, 128)
IF Length% >= 128 THEN
res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
ERROR STFERR
END IF
IF Length% = -1 THEN
ERROR STFERR
END IF
GetSectionKeyVersion = szBuf$
szBuf$ = ""
END FUNCTION
SUB MakeListFromSectionDate (szSym$, szSect$) STATIC
IF FMakeListInfSectionField(szSym$, szSect$, 5) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB MakeListFromSectionFilename (szSym$, szSect$) STATIC
IF FMakeListInfSectionField(szSym$, szSect$, 1) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB MakeListFromSectionSize (szSym$, szSect$) STATIC
IF FMakeListInfSectionField(szSym$, szSect$, 15) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB MakeListFromSectionVersion (szSym$, szSect$) STATIC
IF FMakeListInfSectionField(szSym$, szSect$, 19) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB InitInstall STATIC
IF hSetup > 0 THEN
ELSEIF FInitializeInstall(HinstFrame(), HwndFrame()) = 0 THEN
END
END IF
END SUB
SUB CreateDir (szDir$, cmo%) STATIC
IF FCreateDir(szDir$, cmo%) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB RemoveDir (szDir$, cmo%) STATIC
IF FRemoveDir(szDir$, cmo%) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB RemoveIniSection (szFile$, szSect$, cmo%) STATIC
IF FRemoveIniSection(szFile$, szSect$, cmo%) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB CreateIniKeyValue (szFile$, szSect$, szKey$, szValue$, cmo%) STATIC
IF FCreateIniKeyValue(szFile$, szSect$, szKey$, szValue$, cmo%) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB RemoveIniKey (szFile$, szSect$, szKey$, cmo%) STATIC
IF FRemoveIniKey(szFile$, szSect$, szKey$, cmo%) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB CreateSysIniKeyValue (szFile$, szSect$, szKey$, szValue$, cmo%) STATIC
IF FCreateSysIniKeyValue(szFile$, szSect$, szKey$, szValue$, cmo%) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB CreateProgmanGroup (szGroup$, szPath$, cmo%) STATIC
IF FCreateProgManGroup(szGroup$, szPath$, cmo%) = 0 THEN
ERROR STFPROGMAN
END IF
END SUB
SUB ShowProgmanGroup (szGroup$, Cmd%, cmo%) STATIC
IF FShowProgManGroup(szGroup$, STR$(Cmd%), cmo%) = 0 THEN
ERROR STFPROGMAN
END IF
END SUB
SUB StampResource (szSect$, szKey$, szDst$, wResType%, wResId%, szData$, cbData%) STATIC
IF FStampResource (szSect$, szKey$, szDst$, wResType%, wResId%, szData$, cbData%) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB DumpCopyList (szFile$) STATIC
IF FDumpCopyListToFile (szFile$) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB ClearCopyList STATIC
ResetCopyList
END SUB
FUNCTION GetCopyListCost (szExtraList$, szCostList$, szNeedList$) STATIC AS LONG
lNeed& = LcbGetCopyListCost (szExtraList$, szCostList$, szNeedList$)
IF lNeed& < 0 THEN
ERROR STFERR
END IF
GetCopyListCost = lNeed&
END FUNCTION
SUB CreateProgmanItem (szGroup$, szItem$, szCmd$, szOther$, cmo%) STATIC
szItemNew$ = szItem$
IF szOther$ <> "" THEN
szItemNew$ = szItem$ + "," + szOther$
END IF
IF FCreateProgManItem(szGroup$, szItemNew$, szCmd$, cmo%) = 0 THEN
ERROR STFPROGMAN
END IF
szItemNew$ = ""
END SUB
SUB AddDos5Help (szProgName$, szProgHelp$, cmo%) STATIC
IF FAddDos5Help (szProgName$, szProgHelp$, cmo%) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB CopyFilesInCopyList STATIC
grc% = GrcCopyFilesInCopyList (HinstFrame())
IF grc% = grcUserQuit THEN
ERROR STFQUIT
ELSEIF grc% > 0 THEN
ERROR STFERR
END IF
END SUB
SUB CopyFile (szFullPathSrc$, szFullPathDst$, cmo%, fAppend%) STATIC
IF FCopyOneFile(szFullPathSrc$, szFullPathDst$, (cmo OR cmoCopy), fAppend%) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB RemoveFile (szFullPathSrc$, cmo%) STATIC
IF YnrcRemoveFile(szFullPathSrc$, cmo%) = ynrcNo THEN
ERROR STFERR
END IF
END SUB
SUB BackupFile (szFullPath$, szBackup$) STATIC
IF YnrcBackupFile(szFullPath$, szBackup$, cmoNone) = ynrcNo THEN
ERROR STFERR
END IF
END SUB
SUB RenameFile (szFullPath$, szBackup$) STATIC
IF YnrcBackupFile(szFullPath$, szBackup$, cmoNone) = ynrcNo THEN
ERROR STFERR
END IF
END SUB
SUB AddSectionFilesToCopyList (szSect$, szSrc$, szDest$) STATIC
IF FAddSectionFilesToCopyList (szSect$, szSrc$, szDest$) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB AddSectionKeyFileToCopyList (szSect$, szKey$, szSrc$, szDest$) STATIC
IF FAddSectionKeyFileToCopyList (szSect$, szKey$, szSrc$, szDest$) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB AddSpecialFileToCopyList (szSect$, szKey$, szSrc$, szDest$) STATIC
IF FAddSpecialFileToCopyList (szSect$, szKey$, szSrc$, szDest$) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB AddToBillboardList (szDll$, idDlg%, szProc$, lTicks&) STATIC
IF FAddToBillboardList(szDll$, idDlg%, szProc$, lTicks&) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB AddBlankToBillboardList (lTicks&) STATIC
IF FAddToBillboardList(NULL, 0, NULL, lTicks&) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB ClearBillboardList STATIC
IF FClearBillboardList = 0 THEN
ERROR STFERR
END IF
END SUB
SUB OpenLogFile (szFile$, fAppend%) STATIC
IF FOpenLogFile(szFile$, fAppend%) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB CloseLogFile STATIC
IF FCloseLogFile() = 0 THEN
ERROR STFERR
END IF
END SUB
SUB WriteToLogFile (szStr$) STATIC
IF FWriteToLogFile(szStr$, 1) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB SetCopyGaugePosition (x%, y%) STATIC
ProSetPos x%, y%
END SUB
FUNCTION FindFileUsingFileOpen (szFile$) STATIC AS STRING
szBuf$ = STRING$(512, 32)
wRet% = WFindFileUsingFileOpen(szFile$, szBuf$, len(szBuf$))
IF wRet% = 0 THEN
FindFileUsingFileOpen = szBuf$
ELSEIF wRet% = 1 THEN
FindFileUsingFileOpen = ""
ELSE
ERROR STFERR
END IF
szBuf$ = ""
END FUNCTION
FUNCTION IsDirWritable (szDir$) STATIC AS INTEGER
IsDirWritable = FIsDirWritable(szDir$)
END FUNCTION
FUNCTION IsFileWritable (szFile$) STATIC AS INTEGER
IsFileWritable = FIsFileWritable(szFile$)
END FUNCTION
FUNCTION GetNthFieldFromIniString (szLine$, iField%) STATIC AS STRING
IF iField% < 1 THEN
ERROR STFERR
END IF
szStart$ = szLine$
IF iField% <> 1 THEN
FOR i% = 2 TO iField% STEP 1
iNew% = INSTR(szStart$, ",")
IF iNew% = 0 THEN
GetNthFieldFromIniString = ""
GOTO _GNFFIS_END
END IF
szStart$ = MID$(szStart$, (iNew% + 1))
NEXT
END IF
iNew% = INSTR(szStart$, ",")
IF iNew% <> 0 THEN
szStart$ = MID$(szStart$, 1, (iNew% - 1))
END IF
GetNthFieldFromIniString = LTRIM$(RTRIM$(szStart$))
_GNFFIS_END:
END FUNCTION
FUNCTION GetWindowsMajorVersion STATIC AS INTEGER
GetWindowsMajorVersion = GetVersion() MOD 256
END FUNCTION
FUNCTION GetWindowsMinorVersion STATIC AS INTEGER
GetWindowsMinorVersion = GetVersion() / 256
END FUNCTION
FUNCTION GetWindowsMode STATIC AS INTEGER
GetWindowsMode = 0
longTmp& = GetWinFlags()
IF longTmp& AND WF_STANDARD THEN
GetWindowsMode = 1
ELSEIF longTmp& AND WF_ENHANCED THEN
GetWindowsMode = 2
END IF
END FUNCTION
FUNCTION GetWindowsDir STATIC AS STRING
szBuf$ = string$(256, 32)
cbBuf% = GetWindowsDirectory(szBuf$, 256)
IF cbBuf% = 0 THEN
GetWindowsDir = ""
ERROR STFERR
ELSE
IF cbBuf% > 255 THEN
res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
ERROR STFERR
END IF
szBuf$ = RTRIM$(szBuf$)
IF MID$(szBuf$, 1, 1) = "\" THEN
'szBuf$ = MID$(CURDIR$, 1, 2) + szBuf$
szBuf$ = MID$(GetWindowsSysDir, 1, 2) + szBuf$
ELSEIF MID$(szBuf$, 2, 1) <> ":" THEN
szBuf$ = MID$(GetWindowsSysDir, 1, 3) + szBuf$
END IF
IF MID$(szBuf$, LEN(szBuf$), 1) <> "\" THEN
szBuf$ = szBuf$ + "\"
END IF
GetWindowsDir = szBuf$
END IF
szBuf$ = ""
END FUNCTION
FUNCTION GetWindowsSysDir STATIC AS STRING
szBuf$ = string$(256, 32)
cbBuf% = GetSystemDirectory(szBuf$, 256)
IF cbBuf% = 0 THEN
ERROR STFERR
ELSE
IF cbBuf% > 255 THEN
res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
ERROR STFERR
END IF
szBuf$ = RTRIM$(szBuf$)
IF MID$(szBuf$, 1, 1) = "\" THEN
szBuf$ = MID$(CURDIR$, 1, 2) + szBuf$
ELSEIF MID$(szBuf$, 2, 1) <> ":" THEN
szBuf$ = MID$(CURDIR$, 1, 3) + szBuf$
END IF
IF MID$(szBuf$, LEN(szBuf$), 1) <> "\" THEN
szBuf$ = szBuf$ + "\"
END IF
GetWindowsSysDir = szBuf$
END IF
szBuf$ = ""
END FUNCTION
FUNCTION IsWindowsShared STATIC AS INTEGER
szWin$ = UCASE$(GetWindowsDir())
szSys$ = UCASE$(GetWindowsSysDir())
IF len(szWin$) = 0 THEN
ERROR STFERR
END IF
IF len(szSys$) <= len(szWin$) THEN
IsWindowsShared = 1
ELSE
szSys$ = MID$(szSys$, 1, len(szWin$))
IF szWin$ = szSys$ THEN
IsWindowsShared = 0
ELSE
IsWindowsShared = 1
END IF
END IF
END FUNCTION
FUNCTION GetScreenWidth STATIC AS INTEGER
GetScreenWidth = GetSystemMetrics(SM_CXSCREEN)
END FUNCTION
FUNCTION GetScreenHeight STATIC AS INTEGER
GetScreenHeight = GetSystemMetrics(SM_CYSCREEN)
END FUNCTION
SUB SetRestartDir (szDir$) STATIC
IF FSetRestartDir(szDir$) = 0 THEN
ERROR STFERR
END IF
END SUB
FUNCTION RestartListEmpty STATIC AS INTEGER
IF FRestartListEmpty() = 0 THEN
RestartListEmpty = 0
ELSE
RestartListEmpty = 1
END IF
END FUNCTION
FUNCTION ExitExecRestart STATIC AS INTEGER
ExitExecRestart = FExitExecRestart
END FUNCTION
SUB PrependToPath (szSrc$, szDst$, szDir$, cmo%) STATIC
IF FPrependToPath (szSrc$, szDst$, szDir$, cmo%) = 0 THEN
ERROR STFERR
END IF
END SUB
TRAP CleanupTrap From "MSSHLSTF.DLL"
End Trap
hSetup = InitSetup(COMMAND$)
ON ERROR GOTO QUIT
''***************************************************************************
'' MSREGDB.INC
''***************************************************************************
'$DEFINE REG_DB_ENABLED
const REG_SZ = 1
const HKEY_CLASSES_ROOT = 1
const ERROR_SUCCESS = 0
DECLARE FUNCTION EercErrorHandler LIB "mscomstf.dll" (grc%, fVital%, sz1$, sz2$, sz3$) AS INTEGER
CONST GRC_API_FAILED = 104
DECLARE FUNCTION RegOpenKey LIB "SHELL.DLL" (hKey&, szSubKey$, phkResult AS POINTER TO LONG) AS LONG
DECLARE FUNCTION RegCreateKey LIB "shell.dll" (hKey&, szSubKey$, phkResult AS POINTER TO LONG) AS LONG
DECLARE FUNCTION RegDeleteKey LIB "shell.dll" (hKey&, szSubKey$) AS LONG
DECLARE FUNCTION RegCloseKey LIB "shell.dll" (hKey&) AS LONG
DECLARE FUNCTION RegQueryValue LIB "shell.dll" (hKey&, szSubKey$, szValue$, lpcb AS POINTER TO LONG) AS LONG
DECLARE FUNCTION RegSetValue LIB "shell.dll" (hKey&, szSubKey$, dwType&, szValue$, cbValue&) AS LONG
DECLARE FUNCTION RegEnumKey LIB "shell.dll" (HkEY&, dwIndex&, szBuffer$, dwBufferSize&) AS LONG
DECLARE SUB CreateRegKey(szKey$)
DECLARE SUB CreateRegKeyValue(szKey$, szValue$)
DECLARE SUB SetRegKeyValue(szKey$, szValue$)
DECLARE SUB DeleteRegKey(szKey$)
DECLARE FUNCTION GetRegKeyValue(szKey$) AS STRING
DECLARE FUNCTION DoesRegKeyExist(szKey$) AS INTEGER
SUB CreateRegKey(szKey$) STATIC
DIM phKey AS LONG
IF RegCreateKey(HKEY_CLASSES_ROOT, szKey$, VARPTR(phKey)) > ERROR_SUCCESS THEN
i% = EercErrorHandler(GRC_API_FAILED, 1, "CreateRegKey", NULL, NULL)
ERROR STFERR
END IF
IF RegCloseKey(phKey) > ERROR_SUCCESS THEN
i% = EercErrorHandler(GRC_API_FAILED, 1, "CreateRegKey", NULL, NULL)
ERROR STFERR
END IF
END SUB
SUB CreateRegKeyValue(szKey$, szValue$) STATIC
DIM phKey AS LONG
IF RegSetValue(HKEY_CLASSES_ROOT, szKey$, REG_SZ, szValue$, len(szKey$)) > ERROR_SUCCESS THEN
i% = EercErrorHandler(GRC_API_FAILED, 1, "CreateRegKeyValue", NULL, NULL)
ERROR STFERR
END IF
END SUB
FUNCTION DoesRegKeyExist(szKey$) STATIC AS INTEGER
DIM phKey AS LONG
IF RegOpenKey(HKEY_CLASSES_ROOT, szKey$, VARPTR(phKey)) = ERROR_SUCCESS THEN
i = RegCloseKey(phKey)
DoesRegKeyExist = 1
ELSE
DoesRegKeyExist = 0
ENDIF
END FUNCTION
SUB SetRegKeyValue(szKey$, szValue$) STATIC
DIM phKey AS LONG
IF RegSetValue(HKEY_CLASSES_ROOT, szKey$, REG_SZ, szValue$, len(szKey$)) > ERROR_SUCCESS THEN
i% = EercErrorHandler(GRC_API_FAILED, 1, "SetRegKeyValue", NULL, NULL)
ERROR STFERR
END IF
END SUB
FUNCTION GetRegKeyValue(szKey$) STATIC AS STRING
szValue$ = string$(512,32)
cb& = len(szValue$)
IF DoesRegKeyExist(szKey$) = 0 THEN
GetRegKeyValue = ""
EXIT FUNCTION
END IF
IF RegQueryValue(HKEY_CLASSES_ROOT, szKey$, szValue$, VARPTR(cb)) = ERROR_SUCCESS THEN
GetRegKeyValue = MID$(szValue$, 1, cb)
ELSE
i% = EercErrorHandler(GRC_API_FAILED, 1, "SetRegKeyValue", NULL, NULL)
ERROR STFERR
END IF
szValue$ = ""
END FUNCTION
SUB DeleteRegKey(szKey$) STATIC
i& = RegDeleteKey(HKEY_CLASSES_ROOT, szKey$)
END SUB
''***************************************************************************
'' MSCPYDIS.INC
''***************************************************************************
DECLARE FUNCTION FInitSystem1 LIB "mscpydis.dll" (did%, sz$, fNet%) AS INTEGER
DECLARE FUNCTION FInitSystem3 LIB "mscpydis.dll" (did%, sz$, fAlways%) AS INTEGER
DECLARE FUNCTION FCloseSystem LIB "mscpydis.dll" (szSect$, szKey$, szDst$, wResType%, wResId%) AS INTEGER
DECLARE FUNCTION InitSystemRead (did%, sz$, fNet%) AS INTEGER
DECLARE FUNCTION InitSystemWrite (did%, sz$, fAlways%) AS INTEGER
DECLARE SUB CloseSystem (szSect$, szKey$, szDst$, wResType%, wResId%)
FUNCTION InitSystemRead (did%, sz$, fNet%) STATIC AS INTEGER
InitSystemRead = FInitSystem1(did%, sz$, fNet%)
END FUNCTION
FUNCTION InitSystemWrite (did%, sz$, fAlways%) STATIC AS INTEGER
InitSystemWrite = FInitSystem3(did%, sz$, fAlways%)
END FUNCTION
SUB CloseSystem (szSect$, szKey$, szDst$, wResType%, wResId%) STATIC
IF FCloseSystem (szSect$, szKey$, szDst$, wResType%, wResId%) = 0 THEN
ERROR STFERR
END IF
END SUB
''***************************************************************************
'' MSDETECT.INC
''***************************************************************************
DECLARE FUNCTION CbGetVersionOfFile LIB "msdetstf.dll" (szFile$, szBuf$, cbBuf%) AS INTEGER
DECLARE FUNCTION LGetVersionNthField LIB "msdetstf.dll" (szVersion$, nField%) AS LONG
DECLARE FUNCTION LcbGetSizeOfFile LIB "msdetstf.dll" (szFile$) AS LONG
DECLARE FUNCTION FGetValidDrivesList LIB "msdetstf.dll" (szSymbol$) AS INTEGER
DECLARE FUNCTION FGetLocalHardDrivesList LIB "msdetstf.dll" (szSymbol$) AS INTEGER
DECLARE FUNCTION FGetRemovableDrivesList LIB "msdetstf.dll" (szSymbol$) AS INTEGER
DECLARE FUNCTION FGetNetworkDrivesList LIB "msdetstf.dll" (szSymbol$) AS INTEGER
DECLARE FUNCTION LcbTotalDrive LIB "msdetstf.dll" (nDrive%) AS LONG
DECLARE FUNCTION LcbFreeDrive LIB "msdetstf.dll" (nDrive%) AS LONG
DECLARE FUNCTION FIsValidDrive LIB "msdetstf.dll" (nDrive%) AS INTEGER
DECLARE FUNCTION FIsLocalHardDrive LIB "msdetstf.dll" (nDrive%) AS INTEGER
DECLARE FUNCTION FIsRemoveDrive LIB "msdetstf.dll" (nDrive%) AS INTEGER
DECLARE FUNCTION FIsRemoteDrive LIB "msdetstf.dll" (nDrive%) AS INTEGER
DECLARE FUNCTION FDirExists LIB "msdetstf.dll" (szDir$) AS INTEGER
DECLARE FUNCTION FDoesFileExist LIB "msdetstf.dll" (szFileName$, mode%) AS INTEGER
DECLARE FUNCTION CbGetDateOfFile LIB "msdetstf.dll" (szFile$, szBuf$, cbBuf%) AS INTEGER
DECLARE FUNCTION FDoesIniSectionExist LIB "msdetstf.dll" (szFile$, szSect$) AS INTEGER
DECLARE FUNCTION FDoesIniKeyExist LIB "msdetstf.dll" (szFile$, szSect$, szKey$) AS INTEGER
DECLARE FUNCTION CbGetIniKeyString LIB "msdetstf.dll" (szFile$, szSect$, szKey$, szBuf$, cbBuf%) AS INTEGER
DECLARE FUNCTION WGetDOSMajorVersion LIB "msdetstf.dll" AS INTEGER
DECLARE FUNCTION WGetDOSMinorVersion LIB "msdetstf.dll" AS INTEGER
DECLARE FUNCTION CbGetEnvVariableValue LIB "msdetstf.dll" (szEnvVar$, szBuf$, cbBuf%) AS INTEGER
DECLARE FUNCTION WGetNumWinApps LIB "msdetstf.dll" AS INTEGER
DECLARE FUNCTION FGetParallelPortsList LIB "msdetstf.dll" (szSymbol$) AS INTEGER
DECLARE FUNCTION FGetSerialPortsList LIB "msdetstf.dll" (szSymbol$) AS INTEGER
DECLARE FUNCTION FHas87MathChip LIB "msdetstf.dll" AS INTEGER
DECLARE FUNCTION FHasMonochromeDisplay LIB "msdetstf.dll" AS INTEGER
DECLARE FUNCTION FHasMouseInstalled LIB "msdetstf.dll" AS INTEGER
DECLARE FUNCTION WGetConfigSmartdrvSize LIB "msdetstf.dll" AS INTEGER
DECLARE FUNCTION WGetConfigRamdriveSize LIB "msdetstf.dll" AS INTEGER
DECLARE FUNCTION WGetConfigNumBuffers LIB "msdetstf.dll" AS INTEGER
DECLARE FUNCTION WGetConfigNumFiles LIB "msdetstf.dll" AS INTEGER
DECLARE FUNCTION WGetConfigLastDrive LIB "msdetstf.dll" AS INTEGER
DECLARE FUNCTION FIsDriverInConfig LIB "msdetstf.dll" (szDrv$) AS INTEGER
DECLARE FUNCTION CbFindTargetOnEnvVar LIB "msdetstf.dll" (szFile$, szEnvVar$, szBuf$, cbBuf%) AS INTEGER
DECLARE FUNCTION CbFindFileInTree LIB "msdetstf.dll" (szFile$, szDir$, szBuf$, cbBuf%) AS INTEGER
DECLARE FUNCTION GetTypeFaceNameFromTTF LIB "msdetstf.dll" (szFile$, szBuf$, cbBuf%) AS INTEGER
DECLARE FUNCTION GetExistingFOTFileForTTF LIB "msdetstf.dll" (szFile$, szBuf$, cbBuf%) AS INTEGER
DECLARE FUNCTION IsDriveValid (szDrive$) AS INTEGER
DECLARE FUNCTION IsDriveLocalHard (szDrive$) AS INTEGER
DECLARE FUNCTION IsDriveRemovable (szDrive$) AS INTEGER
DECLARE FUNCTION IsDriveNetwork (szDrive$) AS INTEGER
DECLARE SUB GetValidDrivesList (szSymbol$)
DECLARE SUB GetLocalHardDrivesList (szSymbol$)
DECLARE SUB GetRemovableDrivesList (szSymbol$)
DECLARE SUB GetNetworkDrivesList (szSymbol$)
DECLARE FUNCTION GetTotalSpaceForDrive (szDrive$) AS LONG
DECLARE FUNCTION GetFreeSpaceForDrive (szDrive$) AS LONG
DECLARE FUNCTION GetDOSMajorVersion AS INTEGER
DECLARE FUNCTION GetDOSMinorVersion AS INTEGER
DECLARE FUNCTION GetEnvVariableValue (szEnvVar$) AS STRING
DECLARE FUNCTION GetNumWinApps AS INTEGER
DECLARE FUNCTION DoesFileExist (szFile$, mode%) AS INTEGER
DECLARE FUNCTION GetDateOfFile (szFile$) AS STRING
DECLARE FUNCTION GetYearFromDate (szDate$) AS INTEGER
DECLARE FUNCTION GetMonthFromDate (szDate$) AS INTEGER
DECLARE FUNCTION GetDayFromDate (szDate$) AS INTEGER
DECLARE FUNCTION GetHourFromDate (szDate$) AS INTEGER
DECLARE FUNCTION GetMinuteFromDate (szDate$) AS INTEGER
DECLARE FUNCTION GetSecondFromDate (szDate$) AS INTEGER
DECLARE FUNCTION GetVersionOfFile (szFile$) AS STRING
DECLARE FUNCTION GetVersionNthField (szVersion$, nField%) AS LONG
DECLARE FUNCTION GetSizeOfFile (szFile$) AS LONG
DECLARE FUNCTION FindTargetOnEnvVar (szFile$, szEnvVar$) AS STRING
DECLARE FUNCTION FindFileInTree (szFile$, szDir$) AS STRING
DECLARE FUNCTION DoesDirExist (szDir$) AS INTEGER
DECLARE FUNCTION DoesIniSectionExist (szFile$, szSect$) AS INTEGER
DECLARE FUNCTION DoesIniKeyExist (szFile$, szSect$, szKey$) AS INTEGER
DECLARE FUNCTION GetIniKeyString (szFile$, szSect$, szKey$) AS STRING
DECLARE FUNCTION GetConfigSmartdrvSize AS INTEGER
DECLARE FUNCTION GetConfigRamdriveSize AS INTEGER
DECLARE FUNCTION GetConfigNumBuffers AS INTEGER
DECLARE FUNCTION GetConfigNumFiles AS INTEGER
DECLARE FUNCTION GetConfigLastDrive AS STRING
DECLARE FUNCTION IsDriverInConfig (szDrv$) AS INTEGER
DECLARE FUNCTION GetProcessorType AS INTEGER
DECLARE SUB GetParallelPortsList (szSymbol$)
DECLARE SUB GetSerialPortsList (szSymbol$)
DECLARE FUNCTION Has87MathChip AS INTEGER
DECLARE FUNCTION HasMonochromeDisplay AS INTEGER
DECLARE FUNCTION HasMouseInstalled AS INTEGER
FUNCTION IsDriveValid (szDrive$) STATIC AS INTEGER
IsDriveValid = FIsValidDrive(ASC(UCASE$(szDrive$)) - ASC("A") + 1)
END FUNCTION
FUNCTION IsDriveLocalHard (szDrive$) STATIC AS INTEGER
IsDriveLocalHard = FIsLocalHardDrive(ASC(UCASE$(szDrive$)) - ASC("A") + 1)
END FUNCTION
FUNCTION IsDriveRemovable (szDrive$) STATIC AS INTEGER
IsDriveRemovable = FIsRemoveDrive(ASC(UCASE$(szDrive$)) - ASC("A") + 1)
END FUNCTION
FUNCTION IsDriveNetwork (szDrive$) STATIC AS INTEGER
IsDriveNetwork = FIsRemoteDrive(ASC(UCASE$(szDrive$)) - ASC("A") + 1)
END FUNCTION
FUNCTION GetTotalSpaceForDrive (szDrive$) STATIC AS LONG
GetTotalSpaceForDrive = LcbTotalDrive(ASC(UCASE$(szDrive$)) - ASC("A") + 1)
END FUNCTION
FUNCTION GetFreeSpaceForDrive (szDrive$) STATIC AS LONG
GetFreeSpaceForDrive = LcbFreeDrive(ASC(UCASE$(szDrive$)) - ASC("A") + 1)
END FUNCTION
SUB GetValidDrivesList (szSymbol$) STATIC
if FGetValidDrivesList(szSymbol$) = 0 then
ERROR STFERR
end if
END SUB
SUB GetLocalHardDrivesList (szSymbol$) STATIC
if FGetLocalHardDrivesList(szSymbol$) = 0 then
ERROR STFERR
end if
END SUB
SUB GetRemovableDrivesList (szSymbol$) STATIC
if FGetRemovableDrivesList(szSymbol$) = 0 then
ERROR STFERR
end if
END SUB
SUB GetNetworkDrivesList (szSymbol$) STATIC
if FGetNetworkDrivesList(szSymbol$) = 0 then
ERROR STFERR
end if
END SUB
FUNCTION GetDOSMajorVersion STATIC AS INTEGER
GetDOSMajorVersion = WGetDOSMajorVersion
END FUNCTION
FUNCTION GetDOSMinorVersion STATIC AS INTEGER
GetDOSMinorVersion = WGetDOSMinorVersion
END FUNCTION
FUNCTION GetEnvVariableValue (szEnvVar$) STATIC AS STRING
cb% = 1024
szBuf$ = STRING$(cb%, 32)
cbRet% = CbGetEnvVariableValue(szEnvVar$, szBuf$, cb%)
GetEnvVariableValue = szBuf$
szBuf$ = ""
END FUNCTION
FUNCTION GetNumWinApps STATIC AS INTEGER
GetNumWinApps = WGetNumWinApps
END FUNCTION
FUNCTION DoesFileExist (szFileName$, mode%) STATIC AS INTEGER
DoesFileExist = FDoesFileExist(szFileName$, mode%)
END FUNCTION
FUNCTION GetDateOfFile (szFile$) STATIC AS STRING
cb% = 20
szBuf$ = STRING$(cb%, 32)
cbRet% = CbGetDateOfFile(szFile$, szBuf$, cb%)
GetDateOfFile = szBuf$
szBuf$ = ""
END FUNCTION
FUNCTION GetYearFromDate (szDate$) STATIC AS INTEGER
GetYearFromDate = VAL(MID$(szDate$, 1, 4))
END FUNCTION
FUNCTION GetMonthFromDate (szDate$) STATIC AS INTEGER
GetMonthFromDate = VAL(MID$(szDate$, 6, 2))
END FUNCTION
FUNCTION GetDayFromDate (szDate$) STATIC AS INTEGER
GetDayFromDate = VAL(MID$(szDate$, 9, 2))
END FUNCTION
FUNCTION GetHourFromDate (szDate$) STATIC AS INTEGER
GetHourFromDate = VAL(MID$(szDate$, 12, 2))
END FUNCTION
FUNCTION GetMinuteFromDate (szDate$) STATIC AS INTEGER
GetMinuteFromDate = VAL(MID$(szDate$, 15, 2))
END FUNCTION
FUNCTION GetSecondFromDate (szDate$) STATIC AS INTEGER
GetSecondFromDate = VAL(MID$(szDate$, 18, 2))
END FUNCTION
FUNCTION GetVersionOfFile (szFile$) STATIC AS STRING
cb% = 30
szBuf$ = STRING$(cb%, 32)
cbRet% = CbGetVersionOfFile(szFile$, szBuf$, cb%)
GetVersionOfFile = szBuf$
szBuf$ = ""
END FUNCTION
FUNCTION GetVersionNthField (szVersion$, nField%) STATIC AS LONG
GetVersionNthField = LGetVersionNthField(szVersion$, nField%)
END FUNCTION
FUNCTION GetSizeOfFile (szFile$) STATIC AS LONG
GetSizeOfFile = LcbGetSizeOfFile(szFile$)
END FUNCTION
FUNCTION FindTargetOnEnvVar (szFile$, szEnvVar$) STATIC AS STRING
cb% = 512
szBuf$ = STRING$(cb%, 32)
cbRet% = CbFindTargetOnEnvVar(szFile$, szEnvVar$, szBuf$, cb%)
IF cbRet% >= cb% THEN
ERROR STFERR
END IF
szBuf$ = RTRIM$(szBuf$)
IF MID$(szBuf$, 1, 1) = "\" THEN
szBuf$ = MID$(CURDIR$, 1, 2) + szBuf$
ELSEIF Len(szBuf$) > 0 AND MID$(szBuf$, 2, 1) <> ":" THEN
szBuf$ = MID$(CURDIR$, 1, 3) + szBuf$
END IF
FindTargetOnEnvVar = szBuf$
szBuf$ = ""
END FUNCTION
FUNCTION FindFileInTree (szFile$, szDir$) STATIC AS STRING
cb% = 512
szBuf$ = STRING$(cb%, 32)
cbRet% = CbFindFileInTree(szFile$, szDir$, szBuf$, cb%)
FindFileInTree = szBuf$
szBuf$ = ""
END FUNCTION
FUNCTION GetConfigSmartdrvSize STATIC AS INTEGER
GetConfigSmartdrvSize = WGetConfigSmartdrvSize
END FUNCTION
FUNCTION GetConfigRamdriveSize STATIC AS INTEGER
GetConfigRamdriveSize = WGetConfigRamdriveSize
END FUNCTION
FUNCTION GetConfigNumBuffers STATIC AS INTEGER
GetConfigNumBuffers = WGetConfigNumBuffers
END FUNCTION
FUNCTION GetConfigNumFiles STATIC AS INTEGER
GetConfigNumFiles = WGetConfigNumFiles
END FUNCTION
FUNCTION GetConfigLastDrive STATIC AS STRING
chRet% = WGetConfigLastDrive
if chRet% = 0 then
GetConfigLastDrive = ""
else
GetConfigLastDrive = CHR$(chRet%)
end if
END FUNCTION
FUNCTION IsDriverInConfig (szDrv$) STATIC AS INTEGER
IsDriverInConfig = FIsDriverInConfig(szDrv$)
END FUNCTION
FUNCTION GetProcessorType STATIC AS INTEGER
GetProcessorType = 0
longTmp& = GetWinFlags()
IF longTmp& AND WF_CPU486 THEN
GetProcessorType = 4
ELSEIF longTmp& AND WF_CPU386 THEN
GetProcessorType = 3
ELSEIF longTmp& AND WF_CPU286 THEN
GetProcessorType = 2
ELSEIF longTmp& AND WF_CPU186 THEN
GetProcessorType = 1
END IF
END FUNCTION
SUB GetParallelPortsList (szSymbol$) STATIC
if FGetParallelPortsList(szSymbol$) = 0 then
ERROR STFERR
end if
END SUB
SUB GetSerialPortsList (szSymbol$) STATIC
if FGetSerialPortsList(szSymbol$) = 0 then
ERROR STFERR
end if
END SUB
FUNCTION Has87MathChip STATIC AS INTEGER
Has87MathChip = FHas87MathChip
END FUNCTION
FUNCTION HasMonochromeDisplay STATIC AS INTEGER
HasMonochromeDisplay = FHasMonochromeDisplay
END FUNCTION
FUNCTION HasMouseInstalled STATIC AS INTEGER
HasMouseInstalled = FHasMouseInstalled
END FUNCTION
FUNCTION DoesDirExist (szDir$) STATIC AS INTEGER
DoesDirExist = FDirExists(szDir$)
END FUNCTION
FUNCTION DoesIniSectionExist (szFile$, szSect$) STATIC AS INTEGER
DoesIniSectionExist = FDoesIniSectionExist(szFile$, szSect$)
END FUNCTION
FUNCTION DoesIniKeyExist (szFile$, szSect$, szKey$) STATIC AS INTEGER
DoesIniKeyExist = FDoesIniKeyExist(szFile$, szSect$, szKey$)
END FUNCTION
FUNCTION GetIniKeyString (szFile$, szSect$, szKey$) STATIC AS STRING
cb% = 512
szBuf$ = STRING$(cb%, 32)
cbRet% = CbGetIniKeyString(szFile$, szSect$, szKey$, szBuf$, cb%)
GetIniKeyString = szBuf$
szBuf$ = ""
END FUNCTION
''***************************************************************************
'' MSSHARED.INC
''***************************************************************************
GLOBAL SharedFileNeedsCopying AS INTEGER
DECLARE FUNCTION WCompareVersion (szVer1$, szVer2$) AS INTEGER
DECLARE FUNCTION FindSharedFileFromPath (szField$, szVersion$) AS STRING
DECLARE FUNCTION SearchForLocationForSharedFile (szRegDbKey$, szWinIniSect$, szWinIniKey$, iWinIniField%, szDefault$, szVersion$) AS STRING
FUNCTION WCompareVersion (szVer1$, szVer2$) STATIC AS INTEGER
IF szVer1$ = "" THEN
IF szVer2$ = "" THEN
WCompareVersion = 0
ELSE
WCompareVersion = -1
END IF
ELSEIF szVer2$ = "" THEN
WCompareVersion = 1
ELSE
WCompareVersion = 0
FOR i% = 1 TO 4 STEP 1
piece1& = GetVersionNthField(szVer1$, i%)
piece2& = GetVersionNthField(szVer2$, i%)
IF piece1& > piece2& THEN
WCompareVersion = 1
GOTO _WCV_END
ELSEIF piece1& < piece2& THEN
WCompareVersion = -1
GOTO _WCV_END
END IF
NEXT i%
END IF
_WCV_END:
END FUNCTION
FUNCTION FindSharedFileFromPath(szField$, szVersion$) STATIC AS STRING
FindSharedFileFromPath = ""
SharedFileNeedsCopying = 0
IF szField$ <> "" THEN
IF DoesFileExist(szField$, OF_EXIST) = 0 THEN
szFile$ = STRING$(32, 32)
IF FParseFATPathIntoPieces(szField$, NULL, 0, NULL, 0, szFile$, 31) <> 0 THEN
szField$ = FindFileUsingFileOpen(szFile$)
ELSE
szField$ = ""
END IF
szFile$ = ""
END IF
IF szField$ <> "" THEN
IF WCompareVersion(GetVersionOfFile(szField$), szVersion$) >= 0 THEN
FindSharedFileFromPath = szField$
ELSEIF IsFileWritable(szField$) <> 0 THEN
SharedFileNeedsCopying = 1
FindSharedFileFromPath = szField$
END IF
szField$ = ""
END IF
END IF
END FUNCTION
FUNCTION SearchForLocationForSharedFile (szRegDbKey$, szWinIniSect$, szWinIniKey$, iWinIniField%, szDefault$, szVersion$) STATIC AS STRING
SearchForLocationForSharedFile = szDefault$
'$IFDEF REG_DB_ENABLED
IF szRegDbKey$ <> "" THEN
szField$ = GetRegKeyValue(szRegDbKey$)
szFile$ = FindSharedFileFromPath(szField$, szVersion$)
IF szFile$ <> "" THEN
SearchForLocationForSharedFile = szFile$
szFile$ = ""
GOTO _SFLSFS_END
END IF
END IF
'$ENDIF '' REG_DB_ENABLED
IF szWinIniSect$ <> "" AND szWinIniKey$ <> "" THEN
szWinIniLine$ = GetIniKeyString("WIN.INI", szWinIniSect$, szWinIniKey$)
IF szWinIniLine$ <> "" THEN
szField$ = GetNthFieldFromIniString(szWinIniLine$, iWinIniField%)
szWinIniLine$ = ""
szFile$ = FindSharedFileFromPath(szField$, szVersion$)
IF szFile$ <> "" THEN
SearchForLocationForSharedFile = szFile$
szFile$ = ""
GOTO _SFLSFS_END
END IF
END IF
END IF
'' return value is still szDefault$ - assume it is writable
SharedFileNeedsCopying = 1
IF DoesFileExist(szDefault$, OF_EXIST) <> 0 THEN
IF WCompareVersion(GetVersionOfFile(szDefault$), szVersion$) >= 0 THEN
SharedFileNeedsCopying = 0
END IF
END IF
_SFLSFS_END:
END FUNCTION